<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <img src="../定时器作业/图片切换/1.jpg" alt="" id="imgid">
    </div>
    <input type="button" value="开始" onclick="aaa(event)">
</body>
    <script>
        var i=1;
        function aaa(event){
           // event.target.value='开始循环';
           var ii=0;
            var temp=setInterval(function(){
                var imgobj=document.getElementById('imgid');
                var k=inter();
                var str='../定时器作业/图片切换/'+k+'.jpg'
                imgobj.src=str;
                ii++;
                if(ii>29){
                    clearInterval(temp);
                }
            },100)
        };

        function inter(){
            i++;
            if(i>9){
                i=1;
            }
            return i;
        }
    </script>
</html>